#include "Animation.h"
#include "../tinyxml\tinyxml.h"

// Default Constructor - Initialize data members to safe values
CAnimation::CAnimation(void)
{
	// TODO: Write code! =D
}

// Load - Load animation data from a file
bool CAnimation::Load(const char* filename)
{
	// TODO: Write code! =D

	// Create the TinyXML Document
	TiXmlDocument doc;
	const char* name;
	// Attempt to load the document from the file
	if( doc.LoadFile( filename ) == false )
		return false;

	// Access the root element in the document
	TiXmlElement* pRoot = doc.RootElement();
	if( pRoot == nullptr )
		return false;

	name = pRoot->Attribute("name");
	TiXmlElement* pDuration = pRoot->FirstChildElement("Duration");
	
	if( pDuration == nullptr )
		return false;

	const char* dur = pDuration->GetText();
	float* f = (float*)dur;
	m_fDuration = *f;

	//AniNode* node;
	//node->m_uiJointIndex = 0;


	
	TiXmlElement* pAniBone = pDuration->NextSiblingElement("animBone");
//	pAniBone = pAniBone->FirstChildElement("boneIndex", 
}

// Destructor - Clean up
CAnimation::~CAnimation(void)
{
	// TODO: Write code! =D
}